import Vue from 'vue'
import uView from "uview-ui";
import App from './App'
import store from './store'
import Api from './api/index'
import Message from '@/pages/pagecomponents/other/message'
import CONFIG from '@/config/config.conf'
import { formatDate, formatTime, formatPrice, format } from '@/utils/format'
import common from '@/utils/common'
import validate from '@/utils/validate'
import GlobalModal from '@/lib/modal/global_function.js' // app端全局modal弹窗
Vue.use(uView); // 引入UI框架

Vue.config.productionTip = false

// 全局api
Vue.prototype.$api = Api;
// 全局静态变量维护
Vue.prototype.$common = common;
// 表单校验
Vue.prototype.$validate = validate;

// 过滤器
Vue.filter('formatDate', formatDate);
Vue.filter('formatTime', formatTime);
Vue.filter('formatPrice', formatPrice);
Vue.filter('format', format );

// app端全局modal弹窗
Vue.use(GlobalModal)

// 微信小程序胶囊按钮尺寸信息
let menuButton = 0;
// #ifndef H5 || APP-PLUS
menuButton = uni.getMenuButtonBoundingClientRect()
// #endif
Vue.prototype.menuButton = menuButton;

// 全局存储应用名
Vue.prototype.appName = CONFIG.appNameE;
Vue.prototype.appNameCNY = CONFIG.appNameC;
Vue.prototype.CONFIG = CONFIG;

// 自定义消息提示
Vue.component('message', Message)

// 默认参数
App.mpType = 'app'
const app = new Vue({
  store, // Vuex
  ...App,
})
app.$mount()
